//package com.mercury.ec.module.air.controller.admin.demandorder;
//
//import com.mercury.ec.framework.apilog.core.annotation.ApiAccessLog;
//import com.mercury.ec.framework.common.pojo.CommonResult;
//import com.mercury.ec.framework.common.pojo.PageParam;
//import com.mercury.ec.framework.common.pojo.PageResult;
//import com.mercury.ec.framework.common.util.object.BeanUtils;
//import com.mercury.ec.framework.excel.core.util.ExcelUtils;
//import com.mercury.ec.module.air.controller.admin.demandorder.vo.demandroute.AirDemandRoutePageReqVO;
//import com.mercury.ec.module.air.controller.admin.demandorder.vo.demandroute.AirDemandRouteRespVO;
//import com.mercury.ec.module.air.controller.admin.demandorder.vo.demandroute.AirDemandRouteSaveReqVO;
//import com.mercury.ec.module.air.dal.dataobject.demandorder.AirDemandRouteDO;
//import com.mercury.ec.module.air.service.demandorder.AirDemandRouteService;
//import io.swagger.v3.oas.annotations.Operation;
//import io.swagger.v3.oas.annotations.Parameter;
//import io.swagger.v3.oas.annotations.tags.Tag;
//import org.springframework.security.access.prepost.PreAuthorize;
//import org.springframework.validation.annotation.Validated;
//import org.springframework.web.bind.annotation.*;
//
//import javax.annotation.Resource;
//import javax.servlet.http.HttpServletResponse;
//import javax.validation.Valid;
//import java.io.IOException;
//import java.util.List;
//
//import static com.mercury.ec.framework.apilog.core.enums.OperateTypeEnum.EXPORT;
//import static com.mercury.ec.framework.common.pojo.CommonResult.success;
//
//@Tag(name = "管理后台 - 机票需求订单方案行程")
//@RestController
//@RequestMapping("/air/demand-route")
//@Validated
//public class AirDemandRouteController {
//
//    @Resource
//    private AirDemandRouteService demandRouteService;
//
//    @PostMapping("/create")
//    @Operation(summary = "创建机票需求订单方案行程")
//    @PreAuthorize("@ss.hasPermission('air:demand-route:create')")
//    public CommonResult<Long> createDemandRoute(@Valid @RequestBody AirDemandRouteSaveReqVO createReqVO) {
//        return success(demandRouteService.createDemandRoute(createReqVO));
//    }
//
//    @PutMapping("/update")
//    @Operation(summary = "更新机票需求订单方案行程")
//    @PreAuthorize("@ss.hasPermission('air:demand-route:update')")
//    public CommonResult<Boolean> updateDemandRoute(@Valid @RequestBody AirDemandRouteSaveReqVO updateReqVO) {
//        demandRouteService.updateDemandRoute(updateReqVO);
//        return success(true);
//    }
//
//    @DeleteMapping("/delete")
//    @Operation(summary = "删除机票需求订单方案行程")
//    @Parameter(name = "id", description = "编号", required = true)
//    @PreAuthorize("@ss.hasPermission('air:demand-route:delete')")
//    public CommonResult<Boolean> deleteDemandRoute(@RequestParam("id") Long id) {
//        demandRouteService.deleteDemandRoute(id);
//        return success(true);
//    }
//
//    @GetMapping("/get")
//    @Operation(summary = "获得机票需求订单方案行程")
//    @Parameter(name = "id", description = "编号", required = true, example = "1024")
//    @PreAuthorize("@ss.hasPermission('air:demand-route:query')")
//    public CommonResult<AirDemandRouteRespVO> getDemandRoute(@RequestParam("id") Long id) {
//        AirDemandRouteDO demandRoute = demandRouteService.getDemandRoute(id);
//        return success(BeanUtils.toBean(demandRoute, AirDemandRouteRespVO.class));
//    }
//
//    @GetMapping("/page")
//    @Operation(summary = "获得机票需求订单方案行程分页")
//    @PreAuthorize("@ss.hasPermission('air:demand-route:query')")
//    public CommonResult<PageResult<AirDemandRouteRespVO>> getDemandRoutePage(@Valid AirDemandRoutePageReqVO pageReqVO) {
//        PageResult<AirDemandRouteDO> pageResult = demandRouteService.getDemandRoutePage(pageReqVO);
//        return success(BeanUtils.toBean(pageResult, AirDemandRouteRespVO.class));
//    }
//
//    @GetMapping("/export-excel")
//    @Operation(summary = "导出机票需求订单方案行程 Excel")
//    @PreAuthorize("@ss.hasPermission('air:demand-route:export')")
//    @ApiAccessLog(operateType = EXPORT)
//    public void exportDemandRouteExcel(@Valid AirDemandRoutePageReqVO pageReqVO,
//                                       HttpServletResponse response) throws IOException {
//        pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
//        List<AirDemandRouteDO> list = demandRouteService.getDemandRoutePage(pageReqVO).getList();
//        // 导出 Excel
//        ExcelUtils.write(response, "机票需求订单方案行程.xls", "数据", AirDemandRouteRespVO.class,
//                BeanUtils.toBean(list, AirDemandRouteRespVO.class));
//    }
//
//}
